
class TUtils:
    def __init__(self):
        pass
    @staticmethod
    def tdbQuerySuccess( queryResult):
        res = 0
        try:
            if( 'results' in queryResult.keys() and len(queryResult['results'])>0 ):
                if ('series' in  (queryResult['results'][0]).keys() ):
                    res = len(queryResult['results'][0]['series'])
        except Exception as er:
            print('tdb query success fail')
        return  res
    @staticmethod
    def tdbQuerySeries( queryResult):
        res = []
        try:
            series = queryResult['results'][0]['series']
            for ser in series:
                dictCol = ser['columns']
                item = [dict(zip(dictCol , x)) for x in ser['values']]
                res.append(item)
        except Exception as er:
            print('tdb query success fail')
        return  res